package com.jeecg.demo.task;

import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.jeecg.demo.service.ThawMarginServiceI;

@Component
public class MarginTask {

	@Autowired
	private SystemService systemService;

	@Scheduled(cron="0 0/6 * * * ? ")
	public void thawMargin() throws Exception{
		service.doThaw();
	}

	@Autowired
	private ThawMarginServiceI service;

	//定时更新出金单据状态
	@Scheduled(cron="0 0/5 * * * ? ")
	public void updatewithdraw(){
		System.out.println("开始定时更新状态！");
		String sql = "update FUNDINOUT t set t.status = nvl((select decode(z.zhuangt,0,'3','4') "
				+ "from soa_sett_xm.nx_outmoneycheck z where z.COMPWATERID = t.messagecode and z.ZHUANGT in (0,1,9)),2) "
				+ "where t.submittime >= trunc(sysdate-10)";
		systemService.executeSql(sql);
		System.out.println("结束定时更新状态！");
	}


}
